package com.tanhua.server.controller;

import com.tanhua.model.vo.PeachVo;
import com.tanhua.server.service.PeachblossomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.text.ParseException;

@RestController
@RequestMapping("/peachblossom")
public class PeachblossomController {
    @Autowired
    private PeachblossomService peachblossomService;
    @GetMapping
    public ResponseEntity<PeachVo> peachReceive() throws ParseException {
        PeachVo vo = peachblossomService.peachReceive();
        return ResponseEntity.ok(vo);
    }
    @PostMapping
    public ResponseEntity peachPost(MultipartFile soundFile) throws IOException {
        peachblossomService.peachPost(soundFile);
        return ResponseEntity.ok(null);
    }
}
